<template>
  <div class="content">
    <dt-search ref="search" :label-width="90">
      <Button type="primary" @click='onExport' v-if="unlocking('0207050801')">导出</Button>
    </dt-search>

    <dt-grid ref="table" page :onFetch='onFetch' />
  </div>
</template>

<script>
  import moment from 'moment'
  import Column from './opt/Column.js'
  import SearchOpt from './opt/SearchOpt.js'
  import financialMgr from '@/biz/report/financialReport.js'

  export default {
    data() {
      return {
        search: {
          bonusStartMonth: moment(new Date()).format('YYYY-MM'),
          bonusEndMonth: moment(new Date()).format('YYYY-MM'),
          housesId: '',
          orgIds: [],
          userId:''
        },
        filterParams:{}
      }
    },
    mounted() {
      this.$refs.table.init(this, new Column())
      this.$refs.search.init(this.$refs.table, new SearchOpt(this.search), this.search)
      this.$refs.table.fetch()
    },
    methods: {
      onFetch(data) {
        this.filterParams = data
        return financialMgr.JYBonusPush(data)
      },
      onExport() {
        financialMgr.exportJYBonusPush(this.filterParams)
      },
    },
  }
</script>

<style lang="scss" scoped>
  .content {
    padding: 20px;
  }
</style>